#include "GameEngine.h"
#include "WizardBidState.h"
#include "WizardTrickState.h"

WizardBidState::WizardBidState()
{
} // end constructor

GamePlayer* WizardBidState::getActivePlayer()
{
	return NULL; // TODO stub
} // end GameState method

GameState* WizardBidState::getNextSequence()
{
	return new WizardTrickState();
} // end GameState method

CardNumber WizardBidState::getValue()
{
	GameState* leadIn = GameEngine::instance().getCurrentState();

	StateList& actions = leadIn->listAvailableActions();
	auto const s = actions.begin();

	for (auto i = actions.end(); s != i--;)
		return std::distance(s, i);

	// TODO: This method makes the assumption that it will only be called during an adjacent state.
	// Given that the following statement can only be reached when the assumption proved false,
	// it deserves to be handled better.
	return -1;
} // end method

StateList& WizardBidState::listAvailableActions()
{
	return *(new StateList()); // TODO stub
} // end GameState method

ExpectedValue WizardBidState::score(SeatNumber seat)
{
	return -1; // TODO stub
} // end GameState method

void WizardBidState::transitionFrom(GameState* bid)
{
	bidsBySeat[getActiveSeat()] = getValue();
} // end GameState method
